﻿@model ProductDetailsModel
@using Nop.Web.Models.Catalog;
@{
    Html.AddScriptParts("~/Scripts/slimbox2.js");

    int productPerRow = 4;
}
<div class="gallery">
    <div class="picture">
        @if (Model.DefaultPictureZoomEnabled)
        {
            <a href="@Model.DefaultPictureModel.FullSizeImageUrl" data-gallery="lightbox-pd" title="@Model.Name">
                <img alt="@Model.DefaultPictureModel.AlternateText" src="@Model.DefaultPictureModel.ImageUrl" title="@Model.DefaultPictureModel.Title" itemprop="image" />
            </a>
        }
        else
        {
            <img alt="@Model.DefaultPictureModel.AlternateText" src="@Model.DefaultPictureModel.ImageUrl" title="@Model.DefaultPictureModel.Title" itemprop="image" />
        }
    </div>
    @if (Model.PictureModels.Count > 1)
    {
        <div class="picture-thumbs">
            @for (int i = 0; i < Model.PictureModels.Count; i++)
            {
                var picture = Model.PictureModels[i];

                if (i % productPerRow == 0)
                {
                @Html.Raw("<div>")
                }
                <a href="@picture.FullSizeImageUrl" data-gallery="lightbox-p" title="@Model.Name">
                    <img src="@picture.ImageUrl" alt="@picture.AlternateText" title="@picture.Title" />
                </a>                 
                if ((i % productPerRow == (productPerRow - 1)) ||
                    //last image
                    (i == (Model.PictureModels.Count - 1)))
                {
                @Html.Raw("</div>")
                }
            }
        </div>
    }
</div>
